import Mock from 'mockjs'

const data = Mock.mock({
  'items': [{
    id: '0',
    photoUrl: 'http://officialwebsitestorage.blob.core.chinacloudapi.cn/public/upload/attachment/2015/11/201511061701346777.png',
    name: '汉堡',
    price: '123.4',
    resume: '大汉堡',
    state: '0',
    saleNum: '10',
    storeNum: '100',
    dishesSeriesId: 1
  },
  {
    id: '1',
    photoUrl: 'http://officialwebsitestorage.blob.core.chinacloudapi.cn/public/upload/attachment/2015/11/201511061701346777.png',
    name: '汉堡',
    price: '1',
    resume: '大汉堡',
    state: '1',
    saleNum: '10',
    storeNum: '100',
    dishesSeriesId: 1
  }]
})

export default [
  {
    url: '/dishes',
    method: 'get',
    response: config => {
      const items = data.items
      return {
        code: 200,
        data: items
      }
    }
  },
  {
    url: '/dishes/0',
    method: 'get',
    response: config => {
      const one = data.items[0]
      return {
        code: 200,
        data: one
      }
    }
  },
  {
    url: '/dishes/1',
    method: 'get',
    response: config => {
      const one = data.items[1]
      return {
        code: 200,
        data: one
      }
    }
  }
]
